import Vue from 'vue'
import Router from 'vue-router'
import * as u from '@/util/util'

Vue.use(Router)

//静态路由
export const staticRouter = [
  {
    path: '/login',
    name: 'login',
    meta: {
      title: "登录"
    },
    component: () => import( '@/view/login')
  },
  {
    path: '/admin',
    name: 'admin',
    redirect: '/sy',
    component: () => import( '@/view/admin'),
    children: [
      {
        path: '/sy',
        name: '首页',
        component: () => import('@/view/sy.vue')
      },
    ]
  },
  {
    path: '/',
    name: 'home',
    redirect: '/home/orderFlowers',
    component: () => import( '@/view/home/index.vue'),
    children: [
      {
        path: '/home/orderFlowers',
        name: '商户入驻',
        component: () => import('@/view/home/orderFlowers.vue')
      },
      {
        path: '/home/merchantsIn',
        name: '商户入驻',
        component: () => import('@/view/home/merchantsIn.vue')
      },
      {
        path: '/home/cart',
        name: '购物车',
        component: () => import('@/view/home/cart.vue')
      },
      {
        path: '/home/goods_info/:id',
        name: '商品详细',
        component: () => import('@/view/home/goods_info.vue')
      },
      {
        path: '/home/order',
        name: '订单查询',
        component: () => import('@/view/home/order.vue')
      },
    ]
  },
  {path:'*',component: () => import( '@/view/404')}
]

const createRouter = () => new Router({
  routes:staticRouter
})

export const router = createRouter()




